<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2018/12/14
 * Time: 16:13
 */

namespace common\sources\read\auditclassify;

use common\models\craftsman\AuditClassify;

class AuditClassifyAccess implements IAuditClassifyAccess {
	//或分类列表
	public function getList() {
		return AuditClassify::find()
			->select("id,name,create_time")
			->orderBy("create_time desc")
			->asArray()
			->all();

	}

	public function getClassify($name) {
		return AuditClassify::find()
			->select("id,name")
			->where(['name' => $name])
			->asArray()
			->one();
	}


	//或分类列表
	public function newGetList($param) {
		return AuditClassify::find()
			->select("id,name,pid,create_time")
			->where($param)
			->orderBy("create_time desc")
			->asArray()
			->all();

	}

	public function newGetClassify($name, $id) {
		return AuditClassify::find()
			->select("id,name")
			->where('name = "' . $name . '" and id !=' . $id)
			->asArray()
			->one();
	}

}